<template>
  <div class="element-menu">
    <div v-for="item in elements" class="element-item" draggable="true" @dragstart="dragstart($event, item)">
      {{ item.name }}
    </div>
  </div>
</template>

<script>
import { elements } from '@/const/elements';
export default {
  name: '',
  data() {
    return {
      elements
    }
  },
  methods: {
    dragstart(event, editorConfig) {
      event.dataTransfer.setData("drop_element", JSON.stringify(editorConfig));
    },
  }
}
</script>

<style lang="scss" scoped>
.element-menu {
  box-sizing: border-box;
  width: 200px;
  display: flex;
  padding: 20px 10px;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  .element-item {
    font-size: 14px;
    color: #ffffff;
    padding: 10px;
    border: 1px solid #efefef;
    width: 50px;
    height: 20px;
    cursor: pointer;
    text-align: center;
    vertical-align: middle;
  }
}
</style>
